import 'package:flutter/material.dart';
import 'package:untitled/pages/home/tab_search/data_list.dart';
import 'package:untitled/widgets/common_image.dart';
import 'package:untitled/widgets/common_tag.dart';

class RoomListItemWidget extends StatelessWidget {
  final RoomListItemData data;

  const RoomListItemWidget(this.data,{Key key}) : super(key: key);


  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTap: (){
        Navigator.of(context).pushNamed('roomDetail/${data.id}');
      },
      child: Container(
        padding: EdgeInsets.only(left: 10.0,right: 10.0),
        child: Row(children: [
          CommonImage(src:data.imageUrl,width: 132.5,height: 100.0,),
          SizedBox(width: 10.0,),
          Expanded(child: Column(
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              //设置文本最大为一行，超出用...代替
              Text(data.title,maxLines: 1,overflow: TextOverflow.ellipsis,style: TextStyle(
                  fontWeight: FontWeight.w600
              ),),
              Text(data.subTitle,maxLines: 1,overflow: TextOverflow.ellipsis),
              Wrap(children: data.tags.map((e) => CommonTag(e+"")).toList(),),
              Text('${data.price} 元/月',style: TextStyle(
                  color: Colors.orange,
                  fontSize: 16.0,
                  fontWeight: FontWeight.w600
              ),)
            ],
          ))
        ],),
      ),
    );
      
  }
}
